package sdk.weinxin.beans.massmessage;

import sdk.weinxin.beans.message.Video;
import sdk.weinxin.beans.massmessage.preview.Preview;
import sdk.weinxin.beans.massmessage.preview.VideoPreview;

/**
 * 仅适用于对 openid 发送接口
 *
 * @author LiYi
 *
 */
public class MassVideoMessage extends MassMessage {

    private Video video;

    public MassVideoMessage() {
        super();
        this.setMsgType("video");
    }

    public MassVideoMessage(Video uploadvideo) {
        super();
        video = uploadvideo;
        this.setMsgType("video");
    }

    public Video getVideo() {
        return video;
    }

    public void setVideo(Video video) {
        this.video = video;
    }

    @Override
    public Preview convert() {
        //转为 Preview，官方未说明该类型
        Preview preview = new VideoPreview(video);
        if (this.getToUser() != null && this.getToUser().size() > 0) {
            preview.setToUser(this.getToUser().iterator().next());
        }
        return preview;
    }
}
